package com.itheima.kebian;

import java.util.*;

/*
快速创建集合的方式
 */
public class Demo02 {


    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();

        list.add("坤坤1");
        list.add("坤坤2");
        list.add("坤坤3");
        list.add("坤坤4");
        System.out.println(list);

        ArrayList<String> list2 = new ArrayList<>(List.of("坤坤1", "坤坤2", "坤坤3", "坤坤4"));
        System.out.println(list2);

        TreeSet<Integer> set = new TreeSet<>(Set.of(1, 11, 22, 33, 44, 55));
        System.out.println(set);

        HashMap<String, Integer> map = new HashMap<>(Map.of("坤坤", 2,"坤坤23", 2, "小璐", 3));
        System.out.println(map);
        HashMap<String, String> map2 = new HashMap<>(Map.ofEntries(Map.entry("坤坤", "i坤"), Map.entry("小鹿", "i鹿")));
        System.out.println(map2);

        HashMap<int[], String> map3 = new HashMap<>();
        int[] arr = new int[5];
        int[] arr2 = new int[6];
        map3.put(arr,"哈哈");
        map3.put(arr2,"哈哈2");
        map3.forEach((k,v)->{
            System.out.println(Arrays.toString(k));
        });
        arr[0]=10;
        map3.forEach((k,v)->{
            System.out.println(Arrays.toString(k));
        });
    }
}
